#ifndef IPROJECTPLUGIN_H
#define IPROJECTPLUGIN_H

#include "exportmarco.h"

/// NOTE: no inherit from IPlugin here, they are not at same level
/// main application cannot load projectmanagerplugin directly, but from the frameworkplugin
class ProjectEventBus;
class IProjectPlugin
{
    public:
        IProjectPlugin() {}
        virtual ~IProjectPlugin() {}
        virtual void Initialize() = 0;
        /// events
        virtual void RegisterEvent( ProjectEventBus* eventBus ) = 0;
        virtual bool HandleEvent( Events::Event* e ) = 0;
        virtual void Release() = 0;
};

// the class factories
typedef IProjectPlugin* create_project_plugin_t();
typedef void destroy_project_plugin_t( IProjectPlugin* p );
typedef const char* get_project_plugin_name_t();
typedef int get_project_plugin_version_t();

#define DECLARE_PROJECT_PLUGIN_CLASS(ClassName) \
extern "C" CINE_DLL_EXPORT ClassName* CreateProjectPluginObject(); \
extern "C" CINE_DLL_EXPORT void DestroyProjectPluginObject( ClassName* p ); \
extern "C" CINE_DLL_EXPORT const char* GetProjectPluginName(); \
extern "C" CINE_DLL_EXPORT int GetProjectPluginVersion();

#define INIT_PROJECT_PLUGIN_FACTORY(ClassName) \
extern "C" CINE_DLL_EXPORT ClassName* CreateProjectPluginObject() { return new ClassName; } \
extern "C" CINE_DLL_EXPORT void DestroyProjectPluginObject( ClassName* p ) { delete p; }

#define INIT_PROJECT_PLUGIN_NAME(NameStr) \
extern "C" CINE_DLL_EXPORT const char* GetProjectPluginName() { return NameStr; }

#define INIT_PROJECT_PLUGIN_VERSION(VersionNum) \
extern "C" CINE_DLL_EXPORT int GetProjectPluginVersion() { return VersionNum; }

#define INIT_PROJECT_PLUGIN_AUTHOR(AuthorStr) \
extern "C" CINE_DLL_EXPORT const char* GetProjectPluginAuthor() { return AuthorStr; }

#endif // IPROJECTPLUGIN_H
